﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="WebUI.Index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>

    <script type="text/javascript" language="javascript">
    function addurl()
    {
       var objdiv= document.getElementById("divurl");
       var objurl=document.getElementById("adurl");
       if(objdiv.style.display=="none"){
            objdiv.style.display="block";
            document.getElementById("divfav").style.display="none";
       }else{
            objdiv.style.display="none";
       }
    }
    
    function addfav()
    {
       var objdiv= document.getElementById("divfav");
       var objurl=document.getElementById("adfav");
       if(objdiv.style.display=="none"){
            objdiv.style.display="block";
            document.getElementById("divurl").style.display="none"
       }else{
            objdiv.style.display="none";
       }
    }
    
    function closedivurl(){
        var obj=document.getElementById("divurl");
        obj.style.display="none";
    }
    
    function cleardivurl(){
        document.getElementById("txtTitle").value="";
        document.getElementById("txtRemark").value="";
        document.getElementById("txtURL").value="";
        document.getElementById("fileImg").value="";
    }
    
    function cleardivfav(){
        document.getElementById("txtName").value="";
    }
    
    function closedivfav(){
        var obj=document.getElementById("divfav");
        obj.style.display="none";
    }
    </script>

</head>
<body style="background-color: Gray">
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
    <td style="width:20%; float:left;">
    
        <asp:TreeView ID="tvFavorite" runat="server" ExpandDepth="0" Width="94px">
            <SelectedNodeStyle BackColor="#0066FF" />
        </asp:TreeView>
    
    </td>
    <td style="width:80%; float:left;">
    
            <a id="adurl" onclick=" addurl()">添加网址</a> <a id="adfav" onclick=" addfav()">添加网址夹</a>
            <div id="divurl" style="display: none">
                <table>
                    <tr>
                        <td>
                            标题：
                        </td>
                        <td>
                            <asp:TextBox runat="server" ID="txtTitle"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            说明：
                        </td>
                        <td>
                            <asp:TextBox runat="server" ID="txtRemark"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            网址：
                        </td>
                        <td>
                            <asp:TextBox runat="server" ID="txtURL"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            类别：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlFavorite" runat="server">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            图片：
                        </td>
                        <td>
                            <asp:FileUpload ID="fileImg" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <asp:Button ID="btnSaveURL" runat="server" Text="保存" OnClick="btnSaveURL_Click" />&nbsp;&nbsp;
                            <button onclick="cleardivurl()">
                                清空</button>&nbsp;&nbsp;
                            <button onclick="closedivurl()">
                                取消</button>
                        </td>
                    </tr>
                </table>
            </div>
            <div id="divfav" style="display: none">
                <table>
                    <tr>
                        <td>
                            文件夹：
                        </td>
                        <td>
                            <asp:TextBox runat="server" ID="txtName"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            父类别：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlPFav" runat="server">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <asp:Button ID="btnSaveFav" runat="server" Text="保存" OnClick="btnSaveFav_Click" />&nbsp;&nbsp;
                            <button onclick="cleardivfav()">
                                清空</button>&nbsp;&nbsp;
                            <button onclick="closedivfav()">
                                取消</button>
                        </td>
                    </tr>
                </table>
            </div>
            <hr />
            <div>
                <asp:Repeater ID="repURL" runat="server">
                    <HeaderTemplate>
                        <table>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr>
                            <td>
                                <img src="../<%# Eval("Img").ToString() %>" alt="" />
                            </td>
                            <td>
                                <%# Eval("Title").ToString() %>
                            </td>
                            <td>
                                <a href="http:\\<%# Eval("URL").ToString() %>">
                                    <%# Eval("URL").ToString() %></a>
                            </td>
                            <td>
                                <%# Eval("Remark").ToString() %>
                            </td>
                            <td>
                                <a href="Details.aspx?url=<%# Eval("URID").ToString() %>">查看详细</a>
                            </td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </div>
    </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
